import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

let routes = [{
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/axios-test',
    name: 'AxiosTest',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import( /* webpackChunkName: "about" */ '../views/AxiosTest.vue')
  },
  {
    path: '/user/list',
    name: 'UserList',
    component: () => import('../views/user/UserList.vue')
  },
  {
    path: '/pdf',
    name: 'PDFTest',
    component: () => import('../views/PDFTest.vue')
  },
  {
    path: '/image',
    name: 'ImageList',
    component: () => import('../views/image/imageList.vue'),
  },
  {
    path: '/iframe',
    name: 'IframeTest',
    component: () => import('../views/IframeTest.vue')
  },
  {
    path: '/table',
    name: 'TableTest',
    component: () => import('../views/TableTest.vue')
  },
  {
    path: '/editTable',
    name: 'editTable',
    component: () => import('../views/demo/EditTable.vue')
  },
  {
    path: '/imageCompression',
    name: 'imageCompression',
    component: () => import('../views/image/imageCompression')
  },
]
/**
 * 以下 route 用来测试
 */
let demo = [{
    path: '/demo/method',
    name: 'TestVueMethod',
    component: () => import('../views/demo/TestVueMethod.vue')
  },
  {
    path: '/demo/array',
    name: 'ArrayMerge',
    component: () => import('../views/demo/ArrayMerge')
  },
  {
    path: '/demo/input',
    name: 'InputTest',
    component: () => import('../views/demo/InputTest.vue')
  },
  //测试组件引入
  {
    path: '/demo/import',
    name: 'ComponentImportTest',
    component: () => import('../views/demo/ComponentImportTest.vue')
  },
  //测试组件引入
  {
    path: '/demo/import02',
    name: 'Parent',
    component: () => import('../views/demo/component-import/Parent.vue')
  },
  //测试excel导出
  {
    path: '/demo/export/excel',
    name: 'ExcelTest',
    component: () => import('../views/demo/ExcelTest.vue')
  },
  //测试前端base64加解密
  {
    path: '/demo/base64',
    name: 'Base64Test',
    component: () => import('../views/demo/Base64Test.vue')
  },
  //测试弹窗可拖拽，去掉覆盖层、并可操作底层的按钮
  {
    path: '/demo/dialog',
    name: 'DialogTest',
    component: () => import('../views/demo/dialogTest.vue')
  },
  {
    path: '/demo',
    name: 'Demo',
    component: () => import('../views/demo/Demo.vue')
  },
  //用来测试websocket
  {
    path: '/websocket',
    name: 'websocket',
    component: () => import('../views/demo/websocket/websocket')
  },
  {
    path: '/websocket2',
    name: 'websocket2',
    component: () => import('../views/demo/websocket/websocket2')
  },
  {
    path: '/websocket/login',
    name: 'websocket3',
    component: () => import('../views/demo/websocket/websocketLogin')
  },
  {
    path: '/img/show',
    name: 'img',
    component: () => import('../views/demo/img/ImageDisplay')
  },
  { //div拖拽移动
    path: '/div/move',
    name: 'move',
    component: () => import('../views/demo/DivMove')
  },
  { //div拖拽移动
    path: '/ip/get',
    name: 'ip',
    component: () => import('../views/demo/IpTest')
  },
  { //list转为tree
    path: '/list/tree',
    name: 'tree',
    component: () => import('../views/demo/list-to-tree')
  },
  { //上传组件
    path: '/upload',
    name: 'upload',
    component: () => import('../views/demo/uploadFile')
  },
  { //上传组件
    path: '/date',
    name: 'date',
    component: () => import('../views/demo/Date')
  },
  { //上传组件
    path: '/querySelector',
    name: 'querySelector',
    component: () => import('../views/demo/querySelector')
  },
  { //上传组件
    path: '/sm',
    name: 'sm',
    component: () => import('../views/sm-crypto-test')
  },
];

routes = routes.concat(demo);
// console.log(">>>>>>>>>>>>>>routes>>>>>>>>>>>>>>", routes)
const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
